﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Applee.FractCommon
{
    public class FractObjects : List<IShape>, IDrawable
    {
        #region IDrawable 成员

        public void OnPaint(System.Windows.Forms.PaintEventArgs pe)
        {
            Rectangle rect = pe.ClipRectangle;
            PointF pointCenter = new PointF((rect.Right + rect.Left) * 0.5F, (rect.Bottom + rect.Top) * 0.5F);

            foreach(IShape s in this)
            {
                s.Points = MathUtils.MovePoints(s.Points, new PointF(0, 0), pointCenter);
                
                if (s is IDrawable)
                {
                    IDrawable d = s as IDrawable;
                    d.OnPaint(pe);
                }
            }
        }

        #endregion
    }
}
